################ Colors ################
ESC_SEQ="\x1b["
COL_RESET=$ESC_SEQ"39;49;00m"
RES_COLOR=$ESC_SEQ"39;49;00m"
RED=$ESC_SEQ"31;01m"
GREEN=$ESC_SEQ"32;01m"
YELLOW=$ESC_SEQ"33;01m"
BLUE=$ESC_SEQ"34;01m"
MAGENTA=$ESC_SEQ"35;01m"
CYAN=$ESC_SEQ"36;01m"
########################################

sourcebool=false
destinationbool=false

source="$1"
destination="$2"

for iarg in $*; do
        CLIinputs[$argCounter]=$iarg

    option=`echo "$iarg" | cut -d"=" -f1`

    if [ "$option" == "--source" ]; then
		sourcebool=true
	    	source=`echo "$iarg" | cut -d"=" -f2`
#		echo -e "the source folder is "$RED"$source"$COL_RESET
	    fi
            
    if [ "$option" == "--destination" ]; then
                 
                 destination=`echo "$iarg" | cut -d"=" -f2`
#                 echo -e "the destination folder is "$RED$destination$COL_RESET

    fi

    if [ "$option" == "-h" -o "$option" == "--help" ]; then
	 
		echo -e "This script has to be launched from the folder that will contain the process folder."
	    	echo -e "Available options:"
		echo -e "--destination=path (default is first argument of the command line)"
		echo -e "--source=path (default is the second argument of the command line)"
		exit
	    fi

    let argCounter=argCounter+1
done    

echo -e "the source folder is "$RED"$source"$COL_RESET
echo -e "the destination folder is "$RED$destination$COL_RESET

for x in `ls $source/Cards/*.dat`; do
    if [ "$x" != "$source/Cards/proc_card_mg5.dat" ]; then
        cp -v $x $destination"/Cards/"
    fi
done
